/////////////////////////////////////////////////////////////////////////////////////
// Include Files
#include "Stopwatch.h"

/////////////////////////////////////////////////////////////////////////////////////
// stopwatch_t Implementation

IE::stopwatch_t::stopwatch_t()
{
	m_iStartTime = 0;
	QueryPerformanceFrequency( (LARGE_INTEGER *)&m_iFrequency );
	Start();
}

IE::stopwatch_t::stopwatch_t( stopwatch_t const &_rhs )
{
	m_iStartTime = _rhs.m_iStartTime;
	m_iFrequency = _rhs.m_iFrequency;
}

IE::stopwatch_t &IE::stopwatch_t::operator =( stopwatch_t const &_rhs )
{
	if( this != &_rhs )
	{
		m_iStartTime = _rhs.m_iStartTime;
		m_iFrequency = _rhs.m_iFrequency;
	}

	return *this;
}

IE::float_t IE::stopwatch_t::Elapsed()
{
	int64_t iCurrentTime;
	QueryPerformanceCounter( (LARGE_INTEGER *)&iCurrentTime );

	return float_t( iCurrentTime - m_iStartTime ) / m_iFrequency;
}
